<template>
  <a-card :title="tableInfo.tableName" >
    <p v-if="tableInfo.tableComment !=''">{{tableInfo.tableComment}}</p>
  </a-card>
</template>
<script>
import {Card as ACard} from 'ant-design-vue';
import { defineComponent } from "vue";

export default defineComponent({
  name: "ErTableSketch",
  inject: ["getNode"],
  components:{
    ACard,
  },
  data() {
    return {
      tableInfo:{
        tableName:'表名称',
        tableComment:'表说明'
      }
    };
  },
  methods: {
    initDataFromNode() {
      console.log("initDataFromNode");
      if (!this.getNode) {
        return;
      }
      const node = this.getNode();
      console.log("initDataFromNode1",node);
      if (!node) {
        return;
      }
      let nodeData = node.getData();
      console.log("initDataFromNode2",nodeData);
      if (nodeData) {
        this.tableInfo = JSON.parse(JSON.stringify(nodeData.tableInfo));
      }
      console.log("initDataFromNode3",this.tableInfo);
    },
  },

  created() {
    this.initDataFromNode();
  },
  mounted() {
    // this.updateNodeSize();
  }
});
</script>
<style>
  .ant-card-head-title,.ant-card-body{
    padding: 0px;
  }
  .ant-card{
    text-align: left;
    padding-left: 10px;
    box-shadow: 5px 5px 10px #ccc;
    border: 1px #ccc solid;
    margin-left: 5px;
    border-radius: 5px;
    height: 50px;
    width: 270px;
  }
  .ant-card-head{
    min-height: 24px;
    line-height: 24px;
    height: 24px;
    padding: 0px;
  }
  .ant-card-body{
    padding-left: 10px;
    color: rgb(98 104 117);
    font-size: 12px;
    padding-top: 3px;
  }
</style>